﻿using System.Windows;
using Microsoft.Xna.Framework;

namespace Patyk.MapEditor.Helpers
{
    public static class PropertiesHelper
    {
        public const string DPISettings = "Editor.DPISettings";

        public static void SetDPI(float dpiX, float dpiY)
        {
            var dpiSettings = new Vector2(dpiX, dpiY);
            AddProperty(DPISettings, dpiSettings);
        }

        public static Vector2 GetDPI()
        {
            var dpiSettings = (Vector2)GetProperty(DPISettings);
            return dpiSettings;
        }

        private static void AddProperty(string key, object value)
        {
            if (Application.Current.Properties.Contains(key))
                Application.Current.Properties[key] = value;
            else
                Application.Current.Properties.Add(key, value);
        }

        private static object GetProperty(string key)
        {
            return Application.Current.Properties[key];
        }
    }
}
